home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amoszine 11
/
Amoszine 11 (Disk 2 of 2).adf
/
Andy_Smith_Complete.lha
/
Interface_Example10.AMOS
/
Interface_Example10.amosSourceCode
Wrap
AMOS Source Code
|
1980-04-14
|
5KB
|
185 lines
'===========================================================================
' Interface example 10. A fully-fledged directory requester!
' Written by Andy Smith for Amoszine
'===========================================================================
Resource Screen Open 0,640,200,0
_GET_DIR
Procedure _GET_DIR
Dim FILE$(500)
A$=A$+"BAse 160,20; SIze 296,172; SAve 1;"
A$=A$+"BOx 0,0,1,296,172;"
A$=A$+"BOx 8,11,67,270,140;"
A$=A$+"BU 4,0,0,24,10,0,0,1;[UNpack 0,0,22;][UNpack 0,0,23; BR 0;]"
A$=A$+"LIne 24,0,28,300; PR 30,1,'Choose a directory',7;"
A$=A$+"VLine 272,11,57,124;"
A$=A$+"VSlide 1,275,13,8,109,2VA,1,1VA,1;[ZoneChange 2,ZonePosition;]"
A$=A$+"ActiveList 2,16,16,30,15,0VA,0,0,2,7;[]"
A$=A$+"LIne 11,143,44,292;"
A$=A$+"EDit 3,16,144,33,100,2VA,2,7;"
A$=A$+"BU 8,152,154,64,16,0,0,1;[UNpack 0,0,13; PR 12,4,'Okay',2;][UNpack 152,154,14; PR 164,159,'Okay',2; BR 0;]"
A$=A$+"BU 9,8,154,64,16,0,0,1;[UNpack 0,0,13; PR 10,4,'Parent',2;][UNpack 8,154,14; PR 18,159,'Parent',2; BR 0;]"
A$=A$+"BU 10,80,154,64,16,0,0,1;[UNpack 0,0,13; PR 10,4,'Drives',2;][UNpack 80,154,14; PR 90,159,'Drives',2; BR 0;]"
A$=A$+"BU 11,272,124,16,8,0,0,1;[UNpack 0,0,BP 63+;][BR 0;]"
A$=A$+"BU 12,272,132,16,8,0,0,1;[UNpack 0,0,BP 65+;][BR 0;]"
A$=A$+"BU 13,226,154,64,16,0,0,1;[UNpack 0,0,13; PR 6,4,'Cancel',2;][UNpack 226,154,14; PR 232,159,'Cancel',2; BR 0;]"
A$=A$+"EXit;"
Dialog Open 3,A$
Gosub _READ_DIR
SLDPOS=0
' Store the address of the first element of the array in an interface variable
Vdialog(3,0)=Array(FILE$(0))
' Set the starting slider position at 0. The variable 2 (2VA) is used
' within the VSlide instruction.
Vdialog(3,2)=SLDPOS
' This IF statement just makes sure that when the trigger on the slider bar
' is right at the bottom, there are no spaces displayed in the activelist.
' Comment the IF statement out and see.
If COUNT>14
Vdialog(3,1)=COUNT-14
Else
Vdialog(3,1)=1
End If
X=Dialog Run(3)
Dialog Update 3,3,Dir$
Repeat
D=Dialog(3)
If D=1 : Rem slider
SLDPOS=Rdialog(3,1)
End If
If D=11
Dec SLDPOS
If SLDPOS<0 : SLDPOS=0 : End If
Vdialog(3,2)=SLDPOS
Dialog Update 3,1,SLDPOS
End If
If D=12
Inc SLDPOS
If SLDPOS>COUNT-15 : SLDPOS=COUNT-15 : End If
Vdialog(3,2)=SLDPOS
Dialog Update 3,1,SLDPOS
End If
If D=2
PATH$=FILE$(Rdialog(3,2))
TEMP$=PATH$
If Left$(PATH$,1)="*"
PATH$=Mid$(PATH$,2,32)
POS=Instr(PATH$," ")
PATH$=Left$(PATH$,POS-1)
Dir$=PATH$
Gosub _READ_DIR
Vdialog(3,0)=Array(FILE$(0))
If COUNT>14
Dialog Update 3,1,,,COUNT-14
Else
Dialog Update 3,1,,,1
End If
Dialog Update 3,3,Dir$
End If
TEMP$=Mid$(TEMP$,2,32)
POS=Instr(TEMP$," ")
TEMP$=Left$(TEMP$,POS-1)
If Right$(TEMP$,1)=":"
Dir$=TEMP$
Gosub _READ_DIR
Vdialog(3,0)=Array(FILE$(0))
If COUNT>14
Dialog Update 3,1,,,COUNT-14
Else
Dialog Update 3,1,,,1
End If
Dialog Update 3,3,Dir$
End If
End If
If D=3
PATH$=Rdialog$(3,3)
Trap Dir$=PATH$
If Errtrap=0
Gosub _READ_DIR
Vdialog(3,0)=Array(FILE$(0))
If COUNT>14
Dialog Update 3,1,,,COUNT-14
Else
Dialog Update 3,1,,,1
End If
Dialog Update 3,3,Dir$
Else
' _ERROR["Directory does not exist"]
End If
End If
If D=9
Parent
PATH$=Dir$
Gosub _READ_DIR
Vdialog(3,0)=Array(FILE$(0))
If COUNT>14
Dialog Update 3,1,,,COUNT-14
Else
Dialog Update 3,1,,,1
End If
Dialog Update 3,3,Dir$
End If
If D=10
Gosub _READ_ASSIGNS
Vdialog(3,0)=Array(FILE$(0))
If COUNT>14
Dialog Update 3,1,,,COUNT-14
Else
Dialog Update 3,1,,,1
End If
Dialog Update 3,3,Dir$
End If
Until D=4 or D=8 or D=13
Dialog Close 3
If D=8 : Rem OK
Print Dir$
End If
End
_READ_DIR:
For COUNT=0 To 500
FILE$(COUNT)=""
Next COUNT
COUNT=0
F$=Dir First$("**")
If Left$(F$,1)="*"
FILE$(COUNT)=F$
Inc COUNT
End If
Repeat
F$=Dir Next$
If Left$(F$,1)="*"
FILE$(COUNT)=F$
Inc COUNT
End If
Until F$=""
Return
_READ_ASSIGNS:
For COUNT=0 To 500
FILE$(COUNT)="**"
Next COUNT
F$=Dev First$("**")
COUNT=0
FILE$(COUNT)=F$
Inc COUNT
Repeat
F$=Dev Next$
FILE$(COUNT)=F$
Inc COUNT
Until F$=""
Return
End Proc